import request from '@/utils/request'

// 查询邮箱通道列表
export function listEmailManage(query) {
  return request({
    url: '/email/EmailManage/list',
    method: 'get',
    params: query
  })
}

// 查询邮箱通道详细
export function getEmailManage(id) {
  return request({
    url: '/email/EmailManage/' + id,
    method: 'get'
  })
}

// 新增邮箱通道
export function addEmailManage(data) {
  return request({
    url: '/email/EmailManage',
    method: 'post',
    data: data
  })
}

// 修改邮箱通道
export function updateEmailManage(data) {
  return request({
    url: '/email/EmailManage',
    method: 'put',
    data: data
  })
}

// 删除邮箱通道
export function delEmailManage(id) {
  return request({
    url: '/email/EmailManage/' + id,
    method: 'delete'
  })
}

// 审核邮箱通道
export function auditEmailManage(data) {
  return request({
    url: '/email/EmailManage/audit',
    method: 'put',
    data: data
  })
}

// 获取待审核的邮箱通道列表
export function pendingEmailManage() {
  return request({
    url: '/email/EmailManage/pending',
    method: 'get'
  })
}

// 邮件任务相关API
// 查询邮件任务列表
export function listEmailTask(query) {
  return request({
    url: '/email/EmailTask/list',
    method: 'get',
    params: query
  })
}

// 查询邮件任务详细
export function getEmailTask(id) {
  return request({
    url: '/email/EmailTask/' + id,
    method: 'get'
  })
}

// 新增邮件任务
export function addEmailTask(data) {
  return request({
    url: '/email/EmailTask',
    method: 'post',
    data: data
  })
}

// 修改邮件任务
export function updateEmailTask(data) {
  return request({
    url: '/email/EmailTask',
    method: 'put',
    data: data
  })
}

// 删除邮件任务
export function delEmailTask(id) {
  return request({
    url: '/email/EmailTask/' + id,
    method: 'delete'
  })
}

// 联系人分组相关API
// 查询联系人分组列表
export function listContactGroup(query) {
  return request({
    url: '/email/ContactGroup/list',
    method: 'get',
    params: query
  })
}

// 查询联系人分组详细
export function getContactGroup(id) {
  return request({
    url: '/email/ContactGroup/' + id,
    method: 'get'
  })
}

// 新增联系人分组
export function addContactGroup(data) {
  return request({
    url: '/email/ContactGroup',
    method: 'post',
    data: data
  })
}

// 修改联系人分组
export function updateContactGroup(data) {
  return request({
    url: '/email/ContactGroup',
    method: 'put',
    data: data
  })
}

// 删除联系人分组
export function delContactGroup(id) {
  return request({
    url: '/email/ContactGroup/' + id,
    method: 'delete'
  })
}

// 联系人客户相关API
// 查询联系人客户列表
export function listContactCustomer(query) {
  return request({
    url: '/email/ContactCustomer/list',
    method: 'get',
    params: query
  })
}

// 查询联系人客户详细
export function getContactCustomer(id) {
  return request({
    url: '/email/ContactCustomer/' + id,
    method: 'get'
  })
}

// 新增联系人客户
export function addContactCustomer(data) {
  return request({
    url: '/email/ContactCustomer',
    method: 'post',
    data: data
  })
}

// 修改联系人客户
export function updateContactCustomer(data) {
  return request({
    url: '/email/ContactCustomer',
    method: 'put',
    data: data
  })
}

// 删除联系人客户
export function delContactCustomer(id) {
  return request({
    url: '/email/ContactCustomer/' + id,
    method: 'delete'
  })
}

// 根据分组ID查询联系人客户
export function getContactCustomerByGroupId(groupId) {
  return request({
    url: '/email/ContactCustomer/group/' + groupId,
    method: 'get'
  })
}
